using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: daiduong19051986@gmail.com 
	/// <summary>
	
    public class RuleProfileInfo
    {
		#region Local Variable
		public enum Field
		{
			RULESET_CODE,
			DESCRIPTN,
			TVC_TB,
			SUSPEND
		}
		private String _RULESET_CODE;
		private String _DESCRIPTN;
		private String _TVC_TB;
		private Int32 _SUSPEND;
		
		public String RULESET_CODE{	get{ return _RULESET_CODE;} set{_RULESET_CODE = value;} }
		public String DESCRIPTN{	get{ return _DESCRIPTN;} set{_DESCRIPTN = value;} }
		public String TVC_TB{	get{ return _TVC_TB;} set{_TVC_TB = value;} }
		public Int32 SUSPEND{	get{ return _SUSPEND;} set{_SUSPEND = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public RuleProfileInfo()
		{
			_RULESET_CODE = "";
			_DESCRIPTN = "";
			_TVC_TB = "";
			_SUSPEND = 0;
		}
		public RuleProfileInfo(
		String RULESET_CODE,
		String DESCRIPTN,
		String TVC_TB,
		Int32 SUSPEND
		)
		{
			_RULESET_CODE = RULESET_CODE;
			_DESCRIPTN = DESCRIPTN;
			_TVC_TB = TVC_TB;
			_SUSPEND = SUSPEND;
		}
		public RuleProfileInfo(DataRow dr)
		{
			if (dr != null)
			{
				_RULESET_CODE = dr[Field.RULESET_CODE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.RULESET_CODE.ToString()]);
				_DESCRIPTN = dr[Field.DESCRIPTN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DESCRIPTN.ToString()]);
				_TVC_TB = dr[Field.TVC_TB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TVC_TB.ToString()]);
				_SUSPEND = dr[Field.SUSPEND.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.SUSPEND.ToString()]);
			}
		}
		public RuleProfileInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_RULESET_CODE = dr[Field.RULESET_CODE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.RULESET_CODE.ToString()]);
				_DESCRIPTN = dr[Field.DESCRIPTN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DESCRIPTN.ToString()]);
				_TVC_TB = dr[Field.TVC_TB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TVC_TB.ToString()]);
				_SUSPEND = dr[Field.SUSPEND.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.SUSPEND.ToString()]);
			}
		}
		public RuleProfileInfo(RuleProfileInfo objEntr)
		{			
			_RULESET_CODE = objEntr.RULESET_CODE;			
			_DESCRIPTN = objEntr.DESCRIPTN;			
			_TVC_TB = objEntr.TVC_TB;			
			_SUSPEND = objEntr.SUSPEND;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("RuleProfileHVJ");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.RULESET_CODE.ToString(), typeof(String)),
				new DataColumn(Field.DESCRIPTN.ToString(), typeof(String)),
				new DataColumn(Field.TVC_TB.ToString(), typeof(String)),
				new DataColumn(Field.SUSPEND.ToString(), typeof(Int32))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.RULESET_CODE.ToString()] = _RULESET_CODE;
			row[Field.DESCRIPTN.ToString()] = _DESCRIPTN;
			row[Field.TVC_TB.ToString()] = _TVC_TB;
			row[Field.SUSPEND.ToString()] = _SUSPEND;
			return row;
		}
        #endregion InitTable
    }
}
